﻿@using System.Data
@using ZoomLa.SQLDAL
@using ZoomLa.Common
@model ZoomLa.SQLDAL.SQL.PageSetting
@{
    string[] urlArr = Request.RawUrl.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
    bool ismyask = urlArr.Length > 0 && urlArr[urlArr.Length - 1].ToLower().Contains("myasklist");
}
@functions{
    protected string getanswer(int id)
    {
        string answer;
        DataTable dt = Sql.Sel("ZL_GuestAnswer", " QueId=" + id, "");
        if (dt.Rows.Count > 0)
        {
            answer = (dt.Rows[0]["Content"]).ToString();
            return answer;
        }
        else
            return " ";
    }
    protected string gettype(int id)
    {
        DataTable dt = Sql.Sel("zl_grade", " GradeID=" + id, "");
        if (dt.Rows.Count > 0)
        {
            string name;
            name = (dt.Rows[0]["GradeName"]).ToString();
            return name;

        }
        else
            return " ";
    }
    protected string Getname(string isNi, string UserName, string UserID)
    {
        string str = "";
        if (isNi == "1") { str = "匿名"; }
        else { str = UserName; }
        return str;
    }
    protected string GetStatus(int id)
    {
        if (id == 0)
        {
            return "未处理";
        }
        else if (id == 1)
        {
            return "处理中";
        }
        else
        {
            return "<font class='red'>已解决</font>";
        }
    }
}
<div id="EGV">
    @if (Model.dt.Rows.Count > 0)
    {
        <ul class="ask-list">
            @foreach (DataRow dr in Model.dt.Rows)
            {
                <li>
                    <div class="ask-list-nums">
                        <p class="ask-focus-nums">
                            <span class="num">@dr["Favorite"]</span>收藏
                        </p>
                        <p class="ask-answer-nums">
                            <span class="num">@dr["Answer"]</span>回答
                        </p>
                    </div>
                    <div class="ask-list-detials">
                        <h2>
                            <a href="MyAnswer?ID=@dr["ID"]">
                                @if (ismyask)
                                {<span class="btn btn-success btn-xs" style="margin-right:5px;">@MvcHtmlString.Create(GetStatus(DataConverter.CLng(dr["Status"])))</span>}
                                @dr["Qcontent"]
                            </a>
                        </h2>
                        <div class="ask-info" title="最新回答">@getanswer(Convert.ToInt32(dr["ID"]))</div>
                        <div class="ask-list-legend">
                            <p class="tags">
                                <span class="tag-title">分类：</span>
                                <a href="List?QueType=@dr["QueType"]" class="tag">@gettype(DataConverter.CLng(dr["QueType"]))</a>
                                <span class="ask-list-time">
                                    @MvcHtmlString.Create(Getname(dr["isNi"] as string, dr["UserName"] as string, dr["UserID"] as string)) · @DataConverter.CDate(dr["AddTime"]).ToString("yyyy/MM/dd HH:mm")
                                </span>
                            </p>
                        </div>
                    </div>
                </li>
            }
        </ul>
        <div class="text-center">@Html.Partial("_page2", Model)</div>
    }
    else
    {
        <div style="border:1px solid #ccc; padding:15px 20px;">当前没有提问</div>
    }
</div>